SUBROUTINE GETCOOKIE
     * Display a simple form, requesting entry of a name in single EditBox.
     * Set the initial value of the EditBox from a previously saved cookie.

     * Include the RealWeb definitions
     INCLUDE #RW.INCLUDE.DEFS FROM /SYSFILES/REALWEB,BP

     EQU AM TO CHAR(254)

     * Retrieve the cookie, if any.
     COOKIEVALUE = ""
     CALL RW_GET_COOKIE("CookieForm", COOKIEVALUE)

     * Start the HTML page.
     CALL RW_START_HTML_PAGE("Cookie Form", "", "", "", "")

     CALL RW_START_PARA("", "")

     IF COOKIEVALUE = "" THEN
          CALL RW_PUT("Please enter your name in the box, then click the Go button")
     END ELSE
          CALL RW_PUT("Your name cannot contain numbers: please re-enter.")
     END

     CALL RW_END_PARA

     CALL RW_START_HTML_FORM("SETCOOKIE", "SETCOOKIE", CLASS)

     * Move the cookie value to the third attribute for use in the
     * aClass parameter of the RW_EDIT_BOX subroutine.
     COOKIEVALUE = AM:AM:COOKIEVALUE
     CALL RW_EDIT_BOX("NAME", 30, COOKIEVALUE)

     CALL RW_SUBMIT_BUTTON("GO", "")

     CALL RW_END_FORM

     * Complete the page.
     CALL RW_END_PAGE
RETURN

Go to top button